package service

import (
	"errors"
	"team-evaluate/internal/model"
)

func (svc *Service) CheckAuth(param *model.LoginRequest) (*model.User, error) {
	user := model.User{
		Email:    param.Account,
		Password: param.Password,
	}
	auth, err := svc.dao.FindOneUser(&user)
	if err != nil {
		return nil, err
	}
	if auth.ID > 0 {
		return auth, nil
	}
	return nil, errors.New("auth info does not exist.")
}
